<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>goodjob-index</title>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" href="../assets/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="../assets/lib/nprogress/nprogress.css">
    <link rel="stylesheet" href="../assets/lib/notie/notie.css">
    <link rel="stylesheet" href="../assets/lib/artDialog/css/ui-dialog.css">
    <link rel="stylesheet" href="../assets/css/main.css">
    <style type="text/css">
        [data-relation="changeTaskType"] {
            display: none;
        }

        fieldset {
            margin-top: 5px;
        }
    </style>
</head>
<body>


<div class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">GoodJob</a>
        </div>
        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav ">
                <li class="active"><a href="#">调度</a></li>
                <li><a href="../exec/index.html">日志</a></li>
                <!--<li><a href="#monitor">监控</a></li>-->
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">欢迎 <span data-use="showUserInfo"></span></a></li>
            </ul>
        </div>
    </div>
</div>


<div class="main">
    <div class="container navbar-fixed-top" id="grid_option_group_box"
         style="padding-top: 50px;display: none;z-index: 1000">
        <div class="row" style="background-color: #e7e7e7;">
            <div class="col-md-offset-8 col-md-4">
                <div class="btn-group pull-right" style="padding: 10px 0;position: relative;">
                    <button type="button" class="btn btn-default btn-sm " data-use="task-add">
                        <span class="glyphicon glyphicon-plus"></span>
                        增加
                    </button>
                    <button type="button" class="btn btn-default  btn-sm  hidden" data-use="task-del"
                            data-from="toolbar"
                            disabled>
                        <span class="glyphicon glyphicon-trash"></span>
                        删除
                    </button>
                    <button type="button" class="btn  btn-default btn-sm " data-use="task-update" disabled>
                        <span class="glyphicon glyphicon-edit"></span>
                        修改
                    </button>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="panel panel-primary" style="border: none">
            <div class="panel-body">
                <form id="query_task_form" role="form" class="form-horizontal">
                    <div class="form-group">
                        <div class="row">
                            <div class="col-md-4 ">
                                <label for="projectId">项目</label>
                                <select name="project_id" id="projectId" class="form-control input-sm">

                                </select>
                            </div>
                            <div class="col-md-4">
                                <label for="taskName">任务名称</label>
                                <input type="text" class="form-control input-sm" placeholder="请输入任务名称" name="task_name"
                                       id="taskName">
                            </div>
                            <div class="col-md-4">
                                <label for="taskGroup">dubbo group</label>
                                <input type="text" class="form-control input-sm" placeholder="dubbo group" id="taskGroup"
                                       name="task_group">
                            </div>

                        </div>
                    </div>
                    <!--<div class="form-group form-group-sm">-->
                    <!--<div class="row">-->
                    <!--<div class="col-md-4">-->
                    <!--<label for="taskType" class="">任务类型</label>-->
                    <!--<select name="type" id="taskType" class="form-control input-sm">-->
                    <!--<option value="0">默认</option>-->
                    <!--<option value="1">分片</option>-->
                    <!--<option value="2">依赖</option>-->
                    <!--</select>-->
                    <!--</div>-->

                    <!--</div>-->
                    <!--</div>-->
                    <div class="form-group form-group-sm">
                        <div class="row">
                            <div class="col-md-1 col-md-offset-11">
                                <button type="button" class="btn btn-default pull-right btn-sm"
                                        data-use="query_tasklist">查询
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <div class="row" id="grid_option_group" style="background-color: #fff;">
            <div class="col-md-4">
                <div class="btn-group pull-left" style="padding: 10px 0;position: relative;">
                    <button class="btn btn-default btn-sm" type="button" data-use="project-add" id="btn_project_add">
                        <span class="glyphicon glyphicon-list-alt"></span>
                        添加项目
                    </button>
                </div>
            </div>
            <div class="col-md-offset-4 col-md-4">
                <div class="btn-group pull-right" style="padding: 10px 0;position: relative;">
                    <button type="button" class="btn btn-default btn-sm" data-use="task-add">
                        <span class="glyphicon glyphicon-plus"></span>
                        增加
                    </button>
                    <button type="button" class="btn  btn-default btn-sm " data-use="task-update" disabled>
                        <span class="glyphicon glyphicon-edit"></span>
                        修改
                    </button>
                    <button type="button" class="btn btn-default  btn-sm " data-use="task-del"
                            data-from="toolbar"
                            disabled>
                        <span class="glyphicon glyphicon-trash"></span>
                        删除
                    </button>
                </div>
            </div>
        </div>
        <div class="panel panel-default">

            <table class="table table-striped  table-responsive table-bordered" id="task_grid">
                <thead>
                <tr>
                    <th>
                        <input type="checkbox" class="checkbox" id="task_checkbox_all" data-use="select_task">
                    </th>
                    <th>任务名称</th>
                    <th>类型</th>
                    <!--<th>任务描述</th>-->
                    <th>任务状态</th>
                    <!--<th>关联项目</th>-->
                    <th>超时(秒)</th>
                    <th>任务跳过</th>
                    <th>dubbo group</th>
                    <th class="text-center">cron表达式</th>
                    <th>上次执行时间</th>
                    <th>下次执行时间</th>
                    <th class="text-center" style="width: 240px">操作</th>
                </tr>
                </thead>
                <tbody>
                <!--模板放置-->
                </tbody>
            </table>
        </div>

    </div>
</div>

<div id="footer">
    <div class="container">
        <p class="text-muted">调度系统@wac</p>
    </div>
</div>
<!--add Modal -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="addModalLabel"><span id="span_how_use"></span>调度任务</h4>
            </div>
            <div class="modal-body">
                <!--弹窗内容模板-->
            </div>
            <div class="modal-footer">
                <button class="btn btn-default btn-sm" data-use="do_put_task" data-from="">保存</button>
                <button class="btn btn-default btn-sm" data-use="do_put_task_and_restart" data-from="">保存并生效</button>
                <button class="btn btn-primary btn-sm" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<!-- 执行机列表 -->
<div class="modal fade" id="hostModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">执行机列表</h4>
            </div>
            <div class="modal-body">


            </div>
            <div class="modal-footer">
                <button class="btn btn-primary btn-sm " data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<!--分片 -->
<div class="modal fade" id="paramModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">分片任务</h4>
            </div>
            <div class="modal-body">
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary btn-sm" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--依赖-->
<div class="modal fade" id="depModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="treeModalLabel">sub job</h4>
            </div>
            <div class="modal-body">
            </div>
            <div class="modal-footer">
                <button class="btn btn-primary btn-sm " data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>

<!--添加项目-->
<div class="hidden" id="project_add_form_box">
    <form class="form" role="form" id="project_add_form">
        <div class="form-group">
            <label>projectName</label>
            <input type="text" class="form-control input-sm" name="name" placeholder="项目名称">
        </div>
        <div class="form-group">
            <label>projectCode</label>
            <input type="input" class="form-control input-sm" name="code" placeholder="项目code">
        </div>
    </form>
</div>

<!--预添加执行机-->
<div class="hidden" id="ip_add_form_box">
    <form class="form" role="form" id="ip_add_form">
        <div class="form-group">
            <label>IP</label>
            <input type="text" class="form-control input-sm" name="ip" placeholder="IP">
        </div>
    </form>
</div>

<script type="text/html" id="add_param_control_tpl">
    <div class="col-sm-4">
        <label>分片参数</label><span class="glyphicon-minus pull-right"
                                 data-use="del_param_control"></span>
        <input placeholder="输入分片参数" type="text" class="form-control input-sm"
               name="paramList"/>
    </div>
</script>
<!--表格操作-->
<script type="text/html" id="tasklist_options_tpl">
    <button type="button" class="btn  btn-default btn-xs" data-use="task-restart">
        <span class="glyphicon glyphicon-refresh"></span>
        重启
    </button>
    {{if task_state==0 }}
    <!--<button type="button" class="btn  btn-default btn-xs "-->
            <!--data-use="task-start">-->
        <!--<span class="glyphicon glyphicon-play"></span>-->
        <!--启用-->
    <!--</button>-->
    {{else if task_state==1}}
    <button type="button" class="btn  btn-default btn-xs"
            data-use="task-stop">
        <span class="glyphicon glyphicon-pause"></span>
        停用
    </button>
    <button type="button" class="btn  btn-default btn-xs " data-tasktriggered
            data-use="trigger-task">
        <span class="glyphicon glyphicon-play-circle"></span>
        执行
    </button>
    <!--<button type="button" class="btn  btn-default btn-xs" data-use="task-restart">-->
        <!--<span class="glyphicon glyphicon-refresh"></span>-->
        <!--重启-->
    <!--</button>-->
    {{/if}}
    <!--<button type="button" class="btn  btn-default btn-xs" data-use="task-del">-->
        <!--<span class="glyphicon glyphicon-remove"></span>-->
        <!--删除-->
    <!--</button>-->

    <!--<span class="glyphicon glyphicon-stop btn-xs btn" title="停止"></span>-->
</script>

<!--项目的模板-->
<script id="projectId_options" type="text/html">
    <option value="-1">--选择项目--</option>
    {{each plist as project i}}
    <option value="{{project.id}}">{{project.name}}</option>
    {{/each}}
</script>


<script src="../assets/lib/jquery.min.js"></script>
<script src="../assets/lib/jquery.form.js"></script>
<script src="../assets/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="../assets/lib/nprogress/nprogress.js"></script>
<script src="../assets/lib/notie/notie.js"></script>
<script src="../assets/lib/fetch.js"></script>
<script src="../assets/lib/template.js"></script>
<script src="../assets/script/util.js"></script>
<script src="../assets/lib/jquery-scrollspy.js"></script>
<script src="../assets/lib/artDialog/dist/dialog-min.js"></script>

<script src="./task.js"></script>
</body>
</html>
